Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KaizenTask1119 Write unit tests for the functions typed_get() and checked_get() #1120

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mihir1906
Copy link
Collaborator

Created this PR for the issue #1119.

Changes Made:
Added unit tests for typed_get() and checked_get().

Testing:

  • For typed_get()
test_dict.py::Test_typed_get::test1 (0.00 s) PASSED                                                                                                                                                                          [  9%]
test_dict.py::Test_typed_get::test10 (0.00 s) PASSED                                                                                                                                                                         [ 18%]
test_dict.py::Test_typed_get::test11 (0.00 s) PASSED                                                                                                                                                                         [ 27%]
test_dict.py::Test_typed_get::test2 (0.00 s) PASSED                                                                                                                                                                          [ 36%]
test_dict.py::Test_typed_get::test3 (0.00 s) PASSED                                                                                                                                                                          [ 45%]
test_dict.py::Test_typed_get::test4 (0.00 s) PASSED                                                                                                                                                                          [ 54%]
test_dict.py::Test_typed_get::test5 (0.00 s) PASSED                                                                                                                                                                          [ 63%]
test_dict.py::Test_typed_get::test6 (0.00 s) PASSED                                                                                                                                                                          [ 72%]
test_dict.py::Test_typed_get::test7 (0.00 s) PASSED                                                                                                                                                                          [ 81%]
test_dict.py::Test_typed_get::test8 (0.00 s) PASSED                                                                                                                                                                          [ 90%]
test_dict.py::Test_typed_get::test9 (0.00 s) PASSED                                                                                                                                                                          [100%]

  • For checked_get()
test_dict.py::Test_checked_get::test1 (0.00 s) PASSED                                                                                                                                                                        [ 20%]
test_dict.py::Test_checked_get::test2 (0.00 s) PASSED                                                                                                                                                                        [ 40%]
test_dict.py::Test_checked_get::test3 (0.00 s) PASSED                                                                                                                                                                        [ 60%]
test_dict.py::Test_checked_get::test4 (0.00 s) PASSED                                                                                                                                                                        [ 80%]
test_dict.py::Test_checked_get::test5 (0.00 s) PASSED                                                                                                                                                                        [100%]

@samarth9008 @sonaalKant @DanilYachmenev please do let me know incase of any further suggestions/changes.

@mihir1906 mihir1906 self-assigned this Aug 20, 2024
@mihir1906 mihir1906 added the PR_for_reviewers The PR needs to be reviewed by Team Leaders label Aug 20, 2024
Copy link
Collaborator

@samarth9008 samarth9008 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets try to maintain the order of the tests w.r.t the code in the function. Currently I see the tests for expected type in typed_get function are written first however that line is written by the end of the function.

Before that many other tests for other LOCs could have been written. Easy to read and check if all the conditions are covered.

For e.g.: test 6 could be the first one as its the simplest execution of the function.

Lets also check if the test actually adds any value w.r.t the functionality of the function being tested.

helpers/test/test_dict.py Show resolved Hide resolved
helpers/test/test_dict.py Outdated Show resolved Hide resolved
helpers/test/test_dict.py Outdated Show resolved Hide resolved
helpers/test/test_dict.py Outdated Show resolved Hide resolved
helpers/test/test_dict.py Outdated Show resolved Hide resolved
helpers/test/test_dict.py Outdated Show resolved Hide resolved
helpers/test/test_dict.py Outdated Show resolved Hide resolved
helpers/test/test_dict.py Outdated Show resolved Hide resolved
helpers/test/test_dict.py Outdated Show resolved Hide resolved
helpers/test/test_dict.py Outdated Show resolved Hide resolved
@mihir1906
Copy link
Collaborator Author

Lets try to maintain the order of the tests w.r.t the code in the function. Currently I see the tests for expected type in typed_get function are written first however that line is written by the end of the function.

Before that many other tests for other LOCs could have been written. Easy to read and check if all the conditions are covered.

For e.g.: test 6 could be the first one as its the simplest execution of the function.

Lets also check if the test actually adds any value w.r.t the functionality of the function being tested.

I've reordered the tests to follow the function’s code execution flow and ensured each test case is valuable for verifying different aspects of the function. This should improve readability and coverage.

helpers/test/test_dict.py Show resolved Hide resolved
helpers/test/test_dict.py Show resolved Hide resolved
helpers/test/test_dict.py Show resolved Hide resolved
@mihir1906
Copy link
Collaborator Author

@gpsaggese @samarth9008 @DanilYachmenev I just wanted to kindly follow up on this PR and see if you had a chance to review it. If there are any changes or additional details you'd like me to address, I’d be happy to make those adjustments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR_for_reviewers The PR needs to be reviewed by Team Leaders
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants